<template>
  <div class="new_info">
      <div class="title">
          <h3>{{info.TITLE}}</h3>
          <div class="title_info">
              <p>{{info.ADD_TIME}}</p>
              <p>评论条数：{{$store.getters.getcommentscount}}条</p>
          </div>
      </div>
      <div class="container" v-html="info.content">
          
      </div>
      <comment :cmt_path="$route.path" :cmt_id="id"></comment>
  </div>
</template>

<script>
import comment from "../comment/comments.vue"
export default {
    data(){
        return{
            info:{},
            id : this.$route.params.id,
            content:""
        }
    },
    methods:{
        getinfo(){
            this.$http.get(`getinfo/${this.id}`).then((result)=>{
                var arr = result.body;
                this.info = arr[0];
			})
        },
        addclickcount(){
            this.$http.get(`addclick/${this.id}`).then((result)=>{
                var data = result.body;
                if(data.status == 0){
                    console.log("文章次数添加成功")
                }
            })
        }
    },
    created(){
        this.getinfo();
        this.addclickcount();

    },
    components:{
        comment
    }
}
</script>
<style lang = 'less' scoped>
    .new_info{
        .title{
            >h3{
                text-align: center;
                font-size: 18px;
            }
            >.title_info{
                display: flex;
                justify-content: space-between;
                padding: 0 10px;
            }
        }
        >img{
            width: 100%;
        }
        >.container{
            color: rgb(76, 78, 78);
            font-size: 16px;
        }
    }
</style>